<?php

class mkolo{
        public function vypis(){
                conndb::getInst()->query("SELECT a.id, a.meno, a.popis, b.Meno FROM  sutazne_kolo a INNER JOIN sutazna_kategoria b on(a.id_sutazna_kategoria=b.id) 
					WHERE a.id_sutaz=\"".$_SESSION['idupravsu']."\" AND a.meno IS NOT NULL ORDER BY b.Meno ");
                return conndb::getInst()->getRowsAsArrayOfObjects();  
                
        }
		public function kategorie(){
			conndb::getInst()->query("SELECT DISTINCT  d.id, d.meno FROM sutazne_kolo e INNER JOIN sutazna_kategoria d on (e.id_sutazna_kategoria=d.id) WHERE e.id_sutaz=\"".$_SESSION['idupravsu']."\"  ");
			$kat = conndb::getInst()->getRowsAsArrayOfObjects();
			return $kat;
		}
		public function odstran($id){
			foreach ($id as $co){
				conndb::getInst()->query("DELETE FROM sutazne_kolo WHERE id=\"".$co."\" ");
				conndb::getInst()->query("DELETE FROM rozhodnca_kola WHERE id_sutazne_kolo=\"".$co."\" ");
				conndb::getInst()->query("DELETE FROM sutaziaci_v_kole WHERE id_sutazne_kolo=\"".$co."\" ");\
				conndb::getInst()->query("DELETE FROM kategoria_hodnotenia WHERE id_sutazne_kolo=\"".$co."\" ");
			}
			
		}
}
?>
